package br.ufc.pet.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Md5Util {

	public static String md5(String valor){
		
		String retorno = "";	
		
		MessageDigest md = null;
		
		try{
			md = MessageDigest.getInstance("MD5");
		} catch(NoSuchAlgorithmException ex){
			ex.printStackTrace();
		}
		BigInteger hash = new BigInteger(1, md.digest(valor.getBytes()));		
		retorno = hash.toString(16);
		
		return retorno;
		
	}
	
}
